<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商户黑名单列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label style="width: 100px;">身份证：</label>
                                <input type="text" name="typeVal"/>
                            </li>
                            <li>
                                <label style="width: 100px;">状态：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="0">启用</option>
                                    <option value="1">禁用</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 120px;">添加日期：</label>
                                <input type="text" class="time-input" readonly placeholder="开始日期" name="params[start]"/>
                                <span>-</span>
                                <input type="text" class="time-input" readonly placeholder="结束日期" name="params[end]"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add('650','850')" shiro:hasPermission="riskControl:riskmerblack:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('riskControl:riskmerblack:edit')}]];
        var removeFlag = [[${@permission.hasPermi('riskControl:riskmerblack:remove')}]];
        var prefix = ctx + "riskControl/riskmerblack";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importTemplateUrl: prefix + "/importTemplate",
                importUrl: prefix + "/importData",
                modalName: "服务商注册权限",
                clickToSelect:true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'typeVal',
                    title: '身份证号'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter:function(value, row, index){
                        if (value == '0'){
                            return "<span style='color: green'>启用</span>";
                        } else if (value == '1'){
                            return "<span style='color: red'>禁用</span>";
                        }

                    }
                },

                {
                    field: 'addNote',
                    title: '添加原因'
                },
                {
                    field: 'addMan',
                    title: '添加人'
                },
                {
                    field: 'addDate',
                    title: '添加日期'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\',\'' + 650 + '\',\'' + 850 + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt5 pt5" style="margin-left: 70%;margin-top: -25px;">
                 &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>
</body>
</html>